import axios from 'axios';
import * as constants from './constants';
import { fromJS } from 'immutable'

const changDetail = (title, content) => ({
    type: constants.CHANGE_DETAIL,
    title,
    content
});

// const addHomeList = (list, nextPage) => ({
//     type: constants.ADD_ARTICLE_LIST,
//     list: fromJS(list),
//     nextPage
// });

export const getDetail = (id) => {
    return (dispatch) => {
        axios.get('/api/detail.json?id' + id).then((res)=>{
            const result = res.data.data;
            dispatch(changDetail(result.title, result.content));
        })
    }
};



